package com.cattsoft.ssm.dao;

import static org.junit.Assert.*;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.junit.Before;
import org.junit.Test;

import com.cattsoft.ssm.dao.UserDao;
import com.cattsoft.ssm.entity.User;
import com.cattsoft.ssm.persistence.UserMapper;

public class UserDaoImplTest {
	private ApplicationContext applicationContext;
	@Before//在setup方法中得到spring 容器
	public void setUp()throws Exception{
		applicationContext = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
	}
	@Test
	public void testFindUserById() throws Exception {
		UserDao userDao = (UserDao) applicationContext.getBean("userDao");
		User user = userDao.findUserById(3);
		System.out.println(user);
	}
	

}
